/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package ecom.beans.entity;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author Mariam Soumaré
 */
@Entity
@Table(name = "productstore")
@NamedQueries({
    @NamedQuery(name = "Productstore.findAll", query = "SELECT p FROM Productstore p"),
    @NamedQuery(name = "Productstore.findById", query = "SELECT p FROM Productstore p WHERE p.id = :id"),
    @NamedQuery(name = "Productstore.findByCity", query = "SELECT p FROM Productstore p WHERE p.city = :city"),
    @NamedQuery(name = "Productstore.findByName", query = "SELECT p FROM Productstore p WHERE p.name = :name")})
public class Productstore implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "ID")
    private Long id;
    @Basic(optional = false)
    @Column(name = "CITY")
    private String city;
    @Basic(optional = false)
    @Column(name = "NAME")
    private String name;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "productstore")
    private List<Produits> produitsList;

    public Productstore() {
    }

    public Productstore(Long id) {
        this.id = id;
    }

    public Productstore(Long id, String city, String name) {
        this.id = id;
        this.city = city;
        this.name = name;
    }

    public Productstore(String city, String productStoreName) {
        this.city = city;
        this.name = productStoreName;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getCity() {
        return city;
    }

    public void setCity(String city) {
        this.city = city;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public List<Produits> getProduitsList() {
        return produitsList;
    }

    public void setProduitsList(List<Produits> produitsList) {
        this.produitsList = produitsList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Productstore)) {
            return false;
        }
        Productstore other = (Productstore) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "ecom.beans.entity.Productstore[id=" + id + "]";
    }

}
